package com.study.singleton.pojo;

/**
 * @ClassName: SafeLazySingleton
 * @Description: 懒汉式单例实现类，线程安全
 * @Details:
 * @Author: 郑港旭
 * @Create: 2021-11-09 17:19
 **/
public class SafeLazySingleton {
    private static SafeLazySingleton instance;

    private SafeLazySingleton(){

    }

    public static synchronized SafeLazySingleton getInstance(){
        if (instance == null){
            instance = new SafeLazySingleton();
        }
        return instance;
    }

    public void showMessage(){
        System.out.println("Hello world!");
    }
}
